﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZhimeiSoft.CharmManager.Server.DAL
{
    public class CustomerPaymentDAL_Const
    {
        public static readonly string SQL_SELECT_CUSTOMERPAYMENT =
        @"SELECT 
	        A.*,
            B.CUSTOMERID,
            F.CNAME AS CUSTOMERNAME,
            B.SERVICEITEMID,
            B.CTOTALNEEDPAY,
	        C.ENAME AS CEMPLOYEENAME,
	        E.SNAME AS SERVICEITEMNAME,
	        E.SERVICEITEMCODE,
	        E.SPRICE AS SERVICEITEMPRICE,
	        E.STIMESPAN AS SERVICEITEMTIMESPAN,
	        D.PNAME AS PAYTYPENAME
        FROM 
	        CUSTOMERPAYMENT A,
	        CUSTOMERSERVICEITEM B,
	        EMPLOYEEINFO C,
	        PAYTYPE D,
	        SERVICEITEM E,
	        CUSTOMINFO F
        WHERE 
	        A.PAYTYPEID = D.PAYTYPEID AND
	        A.CUSTOMERSERVICEITEMID = B.CUSTOMERSERVICEITEMID AND
	        A.CEMPLOYEEID = C.EMPLOYEEID AND
	        B.SERVICEITEMID = E.SERVICEITEMID AND
	        F.CUSTOMERID=B.CUSTOMERID";

        public static readonly string SQL_INSERT_CUSTOMERPAYMENT = @"INSERT INTO CUSTOMERPAYMENT (CPAYDATE, CEMPLOYEEID, CMEMO, CUSTOMERSERVICEITEMID, PAYTYPEID, CMONEY) 
                VALUES (@CPAYDATE, @CEMPLOYEEID, @CMEMO, @CUSTOMERSERVICEITEMID, @PAYTYPEID, @CMONEY)";

        public static readonly string SQL_UPDATE_CUSTOMERPAYMENT = @"UPDATE CUSTOMERPAYMENT SET CPAYDATE=@CPAYDATE, CEMPLOYEEID=@CEMPLOYEEID, 
                CMEMO=@CMEMO, CUSTOMERSERVICEITEMID=@CUSTOMERSERVICEITEMID, PAYTYPEID=@PAYTYPEID, CMONEY=@CMONEY WHERE CPAYMENTID=@CPAYMENTID";

        public static readonly string SQL_DELETE_CUSTOMERPAYMENT = "DELETE FROM CUSTOMERPAYMENT WHERE CPAYMENTID=@CPAYMENTID";
    }
}
